#ifndef _SENSORSAMPLING_H
#define _SENSORSAMPLING_H

#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/display/Display.h>
#include "sensor.h"
#include "data_sender.h"
#include "packet_transmission.h"

/* Driver configuration */
#include "ti_drivers_config.h"
#include "SPIRAM.h"
#include "SPI_ADC.h"
#include "Calculate.h"
#include "QMC5883.h"
//#include "ADCSingle.h"
#include "SysParaConfig.h"

// 定义事件标志位
#define EVENT_FEATURE       (1 << 0)  // 特征计算事件
#define EVENT_MEDIUM        (1 << 1)  // 中低频采样事件
#define EVENT_HIGH          (1 << 2)  // 高频采样事件
#define EVENT_OVERLENGTH    (1 << 3)  // 超长采样事件
#define ALL_EVENTS          (EVENT_FEATURE | EVENT_MEDIUM | EVENT_HIGH | EVENT_OVERLENGTH)

#define TimeMultiplier      (100000)    //系统时钟10us，需转换成秒

extern Display_Handle display;

extern void mainTask(UArg arg0, UArg arg1);

typedef enum{
    Low_Ferq_Xdata = 0,
    Low_Ferq_Ydata,
    Low_ferq_Zdata,
    High_Ferq_Zdata,
    OverLenrth_Zdata
}DataType;

typedef struct{
    uint16_t datatype;//数据类型
    uint16_t data[65536];//数据
}HighFerqData;

typedef struct{
    uint16_t datatype;//数据类型
    uint16_t data[8192];//数据
}LowFerqData;

typedef struct{
    HighFerqData Z_data;
    LowFerqData X_data;
    LowFerqData Y_data;
}SensorVirtulData;

extern SensorVirtulData st_sensorvirtuldata;

typedef struct{
    uint8_t TimesCount;
    uint8_t TimesIndex;
    bool useOverflowMode;
}OverFlowTimes;
typedef struct{
    OverFlowTimes HighFerq;
    OverFlowTimes OverLength;
}UseOverFlow;

#endif